Skip to content

🐛 fix: do not include agent if scope is only Test #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gaeljw
Copy link
Contributor

@gaeljw gaeljw commented Aug 9, 2025

Aims to fix #36

I've added 2 test projects:

  • one with only Test scope => the java agent should not be added in distributions
  • one with Test scope but also another scope => the java agent is added in distributions

The 2nd case is so that this fix is not a breaking change: users are used to not have to explicitly set the "dist" scope and get the java agent added by default. This behaviour is also covered implicitly by other existing test projects but I preferred adding one explicitly for that.

@gaeljw
Copy link
Contributor Author

gaeljw commented Aug 9, 2025

Ping @mkurz @julienrf. I hope you don't mind but I'm not sure you're actively watching this project, hence the explicit notification 🙏

@gaeljw
Copy link
Contributor Author

gaeljw commented Aug 9, 2025

Just realized it may be worth adding a word in the README about this behaviour. Let me know what you think :)

EDIT: added a sentence.

@@ -37,6 +37,8 @@ This will automatically resolve the agent module, bundle the agent artifact in t

By default, sbt-javaagent will only add an agent to distributions. Agents can be optionally enabled for compile, run, or test.

> **Note**: starting from v0.2.0, if the agent is only in `test` scope, it won't be added do distributions. You can set the scope to `dist;test` to retain the previous behaviour.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ I assume this PR would be released as a new minor, feel free to change this line if you prefer to release it as bugfix.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to release at least a new minor version because in main branch we also dropped support for SBT 0.13.
Will take a look at this pr soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Agent in scope Test is added to sbt-native-packager scripts
2 participants